//
//  UISearchBar+Chained.m
//  ObjectCChained
//
//  Created by sny on 2018/5/30.
//  Copyright © 2018年 HuangYangYang. All rights reserved.
//

#import "UISearchBar+Chained.h"

@implementation UISearchBar (Chained)

- (UISearchBar *(^)(BOOL, BOOL, BOOL))chainedUISearchBarButtonSet {
    return ^UISearchBar *(BOOL showsBookmarkButton,BOOL showsSearchResultsButton,BOOL showsCancelButton) {
        self.showsBookmarkButton = showsBookmarkButton;
        self.showsSearchResultsButton = showsSearchResultsButton;
        self.showsCancelButton = showsCancelButton;
        return self;
    };
}

- (UISearchBar *(^)(BOOL))chainedUISearchBarScopeBarSet {
    return ^UISearchBar *(BOOL showsScopeBar) {
        self.showsScopeBar = showsScopeBar;
        return self;
    };
}

- (UISearchBar *(^)(id))chainedUISearchBarDelegate {
    return ^UISearchBar *(id delegateObject) {
        if (delegateObject) { self.delegate = delegateObject;}
        return self;
    };
}

- (UISearchBar *(^)(UISearchBarStyle))chainedUISearchBarStyle {
    return ^UISearchBar *(UISearchBarStyle searchBarStyle) {
        self.searchBarStyle = searchBarStyle;
        return self;
    };
}

- (UISearchBar *(^)(UIBarStyle))chainedUISearchBarBarStyle {
    return ^UISearchBar *(UIBarStyle barStyle) {
        self.barStyle = barStyle;
        return self;
    };
}

- (UISearchBar *(^)(UIColor *, UIColor *))chainedUISearchBarTintColorSet {
    return ^UISearchBar *(UIColor * barTintColor,UIColor * tintColor) {
        if (barTintColor) {self.barTintColor = barTintColor;}
        if (tintColor) {self.tintColor = tintColor;}
        return self;
    };
}

- (UISearchBar *(^)(NSString *))chainedUISearchBarPlaceholder {
    return ^UISearchBar *(NSString * placeholder) {
        if (placeholder) {self.placeholder = placeholder;}
        return self;
    };
}

- (UISearchBar *(^)(UIImage *, UIImage *))chainedUISearchImageSet {
    return ^UISearchBar *(UIImage * backgroundImage,UIImage * scopeBarBackgroundImage) {
        if (backgroundImage) {self.backgroundImage = backgroundImage;}
        if (scopeBarBackgroundImage) {self.scopeBarBackgroundImage = scopeBarBackgroundImage;}
        return self;
    };
}

#pragma mark - setter

- (void)setChainedUISearchBarButtonSet:(UISearchBar *(^)(BOOL, BOOL, BOOL))chainedUISearchBarButtonSet {}

- (void)setChainedUISearchBarScopeBarSet:(UISearchBar *(^)(BOOL))chainedUISearchBarScopeBarSet {}

- (void)setChainedUISearchBarDelegate:(UISearchBar *(^)(id))chainedUISearchBarDelegate {}

- (void)setChainedUISearchBarStyle:(UISearchBar *(^)(UISearchBarStyle))chainedUISearchBarStyle {}

- (void)setChainedUISearchBarBarStyle:(UISearchBar *(^)(UIBarStyle))chainedUISearchBarBarStyle {}

- (void)setChainedUISearchBarTintColorSet:(UISearchBar *(^)(UIColor *, UIColor *))chainedUISearchBarTintColorSet {}

- (void)setChainedUISearchBarPlaceholder:(UISearchBar *(^)(NSString *))chainedUISearchBarPlaceholder {}

- (void)setChainedUISearchImageSet:(UISearchBar *(^)(UIImage *, UIImage *))chainedUISearchImageSet {}

@end
